#ifndef __GAME_APPLICATION_H__
#define __GAME_APPLICATION_H__

#include "game_def.h"
#include <event2/event.h>

class CGameApplication:virtual public CGameRef{
protected:
  BOOL _shutdown = FALSE;
  mseconds_t _delta;
  // UINT64 getElasped()
  UINT64 _delay;
protected:
  event_base* _evbase;
  virtual void doRun() = 0;
  virtual void shutdown();
public:
  CGameApplication();
  virtual BOOL init(event_base* evbase);
  virtual BOOL init();
  void run();
  void run(mseconds_t ms);

  /**
   * @brief 每帧的实际间隔时间
   */
  UINT64 getDelay();
};


#endif
